﻿<%@ Assembly Name="VoteList, Version=1.0.0.0, Culture=neutral, PublicKeyToken=722bed34adb0e5a5" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddCandidate.aspx.cs" Inherits="VoteList.Layouts.VoteList.AddCandidate"
    DynamicMasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <SharePoint:ScriptLink ID="ScriptLink1" Name="sp.ui.dialog.js" LoadAfterUI="true"
        Localizable="false" runat="server" />
    <style type="text/css">
        .s4-ca
        {
            margin-left: 12px;
        }
        .row td
        {
            padding-top: 12px;
            vertical-align: top;
            font-family: "Microsoft YaHei";
            font-size: 12px;
            color: #273226;
        }
        .row td span
        {
            font-size: 10px;
        }
        .singleLine1
        {
            background: url(images/Poll3_5.png) no-repeat left top;
            vertical-align: middle;
            padding-top: 5px;
            padding-left: 12px;
            padding-right: 12px;
            width: 254px;
            height: 23px;
        }
        .singleLine2
        {
            background: url(images/Poll3_4.png) no-repeat left top;
            vertical-align: middle;
            padding-top: 5px;
            padding-left: 12px;
            padding-right: 12px;
            width: 293px;
            height: 23px;
        }
        .singleLine3
        {
            background: url(images/Poll3_3.png) no-repeat left top;
            vertical-align: middle;
            padding-top: 5px;
            width: 295px;
            padding-left: 12px;
            padding-right: 12px;
            height: 23px;
        }
        .multiLine
        {
            height: 143px;
            width: 295px;
            padding-top: 3px;
            padding-left: 12px;
            padding-right: 12px;
            background: url(images/Poll3_2.png) no-repeat left top;
            overflow: hidden;
            float: left;
        }
        .ImageIoc
        {
            padding-left: 26px;
        }
        .dragme
        {
            position: relative;
            margin-bottom: 5px;
            margin-top: 0px;
            margin-left: 5px;
            margin-right: 5px;
        }
        .divclose
        {
            float: right;
        }
    </style>
    <script language="javascript">
        var isdrag = true;
        var x, y;
        var dobj;
        function openDialog() {
            var options = SP.UI.$create_DialogOptions();
            options.url = "/_layouts/VoteList/Message.aspx?Message=<%=Message%>",
            options.width = 350;
            options.height = 140;
            options.title = 'Message';
            options.showClose = true;
            options.allowMaximize = false;
            SP.UI.ModalDialog.showModalDialog(options);
        }
        var flag = false;

        function ShowLocation(ImgD, imageWidth, imageHeight, color) {
            var mDiv = document.getElementById('locationDiv');
            var mImg = document.getElementById('locationImg');
            mDiv.style.display = 'block';
            mDiv.style.top = 100;
            mDiv.style.left = 50;
            mDiv.style.borderWidth = 1 + 'px';
            mDiv.style.borderColor = color;
            mDiv.style.borderStyle = 'solid';
            mDiv.style.width = imageWidth + 'px';
            mDiv.style.height = imageHeight + 'px';
            mImg.src = ImgD;
        }
        function HideLocation() {
            var mDiv = document.getElementById('locationDiv');
            mDiv.style.display = 'none';
        }
        function DrawImage(ImgD, imageWidth, imageHeight) {
            var image = new Image();
            image.src = ImgD.src;
            if (image.width > 0 && image.height > 0) {
                flag = true;
                if (image.width / image.height >= imageWidth / imageHeight) {
                    if (image.width > imageWidth) {
                        ImgD.width = imageWidth;
                        ImgD.height = (image.height * imageWidth) / image.width;
                    } else {
                        ImgD.width = image.width;
                        ImgD.height = image.height;
                    }
                }
                else {
                    if (image.height > imageHeight) {
                        ImgD.height = imageHeight;
                        ImgD.width = (image.width * imageHeight) / image.height;
                    } else {
                        ImgD.width = image.width;
                        ImgD.height = image.height;
                    }
                }
            }
        }
        function movemouse(e) {
            if (isdrag) {
                dobj = document.getElementById('locationDiv');
                dobj.style.left = tx + event.clientX - x;
                dobj.style.top = ty + event.clientY - y;
                return false;
            }
        }

        function selectmouse(e) {
            var fobj = event.srcElement;
            var topelement = "BODY";
            while (fobj.tagName != topelement && fobj.className != "dragme") {
                fobj = fobj.parentElement;
            }
            if (fobj.className == "dragme") {
                isdrag = true;
                dobj = document.getElementById('locationDiv');
                tx = parseInt(dobj.style.left + 0);
                ty = parseInt(dobj.style.top + 0);
                x = event.clientX;
                y = event.clientY;
                //dobj.onmounsemove = movemouse();
                document.onmousemove = movemouse;


                return false;
            } else {
                HideLocation();
            }

        }

        document.onmousedown = selectmouse;
        document.onmouseup = new Function("isdrag=false");
    </script>
</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <div style="background: url(images/Poll3_1left.png) no-repeat left top; float: left;
        padding-left: 388px; margin: 30px 0px 0px 2px; min-height: 600px;">
        <div id="locationDiv" style="display: none; position: absolute; background-color: White">
            <div>
                <a class="divclose" id="closePic" onclick="javascript:HideLocation();">
                    <img src="/_layouts/VoteList/Images/close.png"></img></a></div>
            <img id="locationImg" src="/_layouts/VoteList/Images/Poll_RaceEast.png" alt="" class="dragme"></img>
        </div>
        <table class="row">
            <tr>
                <td>
                    帐&nbsp;&nbsp;&nbsp;&nbsp;号:
                </td>
                <td>
                    <asp:TextBox ID="TextBox3" CssClass="singleLine1" BorderStyle="None" Enabled="false"
                        TextMode="SingleLine" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    姓&nbsp;&nbsp;&nbsp;&nbsp;名:
                </td>
                <td>
                    <asp:TextBox ID="TextBox4" CssClass="singleLine2" BorderStyle="None" TextMode="SingleLine"
                        runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    工&nbsp;&nbsp;&nbsp;&nbsp;位:<br />
                    <span>(6字之内)</span>
                </td>
                <td>
                    <asp:TextBox ID="TextBox1" MaxLength="6" onfocus="this.style.color='#000';if(this.value=='请参考工位图填写所在工位编号') this.value='';"
                        onblur="if(this.value==''){this.style.color='#CCC';this.value='请参考工位图填写所在工位编号';}"
                        Text="请参考工位图填写所在工位编号" ForeColor="#CCCCCC" TextMode="SingleLine" CssClass="singleLine3"
                        Width="295" BorderStyle="None" runat="server"></asp:TextBox>
                    <img src="/_layouts/VoteList/Images/East02.png" style="padding-left: 21px; vertical-align: bottom;" border="0"
                        alt="" onclick="javascript:ShowLocation('/_layouts/VoteList/Images/EastMap.png',830,1136,'#8db4e2');" />
                    <img src="/_layouts/VoteList/Images/West02.png" border="0" style="padding-left: 21px; vertical-align: bottom;"
                        alt="" onclick="javascript:ShowLocation('/_layouts/VoteList/Images/WestMap.png',1090,780,'#ffcc00');" />
                    <br />
                </td>
            </tr>
            <tr>
                <td style="padding-top: 23px">
                    创意描述:<br />
                    <span>(200字之内)</span>
                </td>
                <td>
                    <asp:TextBox ID="TextBox2" Rows="10" CssClass="multiLine" BorderStyle="None" TextMode="MultiLine"
                        runat="server"></asp:TextBox>
                    <div style="float: left; padding-top: 122px; padding-left: 21px">
                        <asp:ImageButton ImageUrl="~/_layouts/VoteList/Images/Button2.png" ID="btnAdd" OnClick="AddCandidateToList"
                            runat="server" /></div>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    Application Page
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea"
    runat="server">
    My Application Page
</asp:Content>
